package com.ly.common.running.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author luoyana
 * @version V1.0
 * @ClassName GlobalExceptionHandler
 * @description 上送和接口定义不一致报错
 * @update 2023/3/9
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    /**
     * Http请求消息序列化异常
     *
     * @param e
     * @return
     */
    @ExceptionHandler({HttpMessageNotReadableException.class})
    public String messageExceptionHandler(HttpMessageNotReadableException e) {
        log.warn("http请求参数转换异常: "+ e.getMessage());
        return "http请求参数转换异常";
    }
}
